package com.shenhaofeng.app.camera;

import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;


/**
 * Created by Administrator on 2016/3/23.
 */
public class Camera implements Parcelable, Serializable {

    private Uri file;


    public Camera(Uri file) {
        this.file = file;
    }


    public Uri getPhotoUri() {
        return file;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Camera camera = (Camera) o;

        return !(file != null ? !file.equals(camera.file) : camera.file != null);

    }


    @Override
    public int hashCode() {
        return file != null ? file.hashCode() : 0;
    }


    @Override
    public int describeContents() {
        return 0;
    }


    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(this.file, flags);
    }


    protected Camera(Parcel in) {
        this.file = in.readParcelable(Uri.class.getClassLoader());
    }


    public static final Creator<Camera> CREATOR = new Creator<Camera>() {
        @Override
        public Camera createFromParcel(Parcel source) {
            return new Camera(source);
        }


        @Override
        public Camera[] newArray(int size) {
            return new Camera[size];
        }
    };
}
